package sync

import "sync"

type GenericSyncMap[K comparable, V any] struct {
	internal sync.Map
}

func (m *GenericSyncMap[K, V]) Store(key K, value V) {
	m.internal.Store(key, value)
}

func (m *GenericSyncMap[K, V]) Load(key K) (V, bool) {
	value, ok := m.internal.Load(key)
	if ok {
		return value.(V), true
	}
	var zero V
	return zero, false
}

func (m *GenericSyncMap[K, V]) Delete(key K) {
	m.internal.Delete(key)
}
